<?php 
error_reporting(E_ALL);
ini_set('display_errors','On');

require_once('db.php');
require_once('config.inc.php');

$db = getDBResource();

//path to directory to scan
$sDir = PATCHES_DIR;
 
$aPatches = glob($sDir."*.{patch-id-,diff-id-}*-done", GLOB_BRACE);

$aIDs = array();

foreach ($aPatches as $p) {
	$sName = basename($p);
	$aIDs[] = mysql_real_escape_string(substr($sName, strpos($sName,"-id-")+4, -5));
}

$sSQL = "UPDATE patch SET done = '1' WHERE id IN (".implode(",",$aIDs).")";

mysql_query($sSQL);

?>